import { S } from '../s';
import { IPSSubAppRef } from './ipssub-app-ref';
import { IPSAppMenuModel } from './appmenu/ipsapp-menu-model';
import { IPSAppDEUIActionGroup } from './dataentity/ipsapp-deuiaction-group';
import { IPSAppView } from './view/ipsapp-view';
import { IPSControl } from '../control/ipscontrol';
import { PSModelObjectImpl } from '../psmodel-object-impl';

export class PSSubAppRefImpl extends PSModelObjectImpl implements IPSSubAppRef {
  protected allpsappdeuiactiongroups: IPSAppDEUIActionGroup[];
  getAllPSAppDEUIActionGroups(): IPSAppDEUIActionGroup[] | null {
    return (
      this.allpsappdeuiactiongroups ||
      (this.allpsappdeuiactiongroups = this.fillChildListModel(
        this.M.getAllPSAppDEUIActionGroups,
        S._20e,
      ) as IPSAppDEUIActionGroup[])
    );
  }

  findPSAppDEUIActionGroup(objKey: any): IPSAppDEUIActionGroup | null {
    return this.getPSModel5(
      S._20e,
      this.getAllPSAppDEUIActionGroups(),
      objKey,
    ) as IPSAppDEUIActionGroup;
  }

  protected allpsappviews: IPSAppView[];
  getAllPSAppViews(): IPSAppView[] | null {
    return (
      this.allpsappviews ||
      (this.allpsappviews = this.fillChildListModel(
        this.M.getAllPSAppViews,
        S._1e,
      ) as IPSAppView[])
    );
  }

  findPSAppView(objKey: any): IPSAppView | null {
    return this.getPSModel5(
      S._1e,
      this.getAllPSAppViews(),
      objKey,
    ) as IPSAppView;
  }

  protected allpsdedrcontrols: IPSControl[];
  getAllPSDEDRControls(): IPSControl[] | null {
    return (
      this.allpsdedrcontrols ||
      (this.allpsdedrcontrols = this.fillChildListModel(
        this.M.getAllPSDEDRControls,
        S._214,
      ) as IPSControl[])
    );
  }

  findPSControl(objKey: any): IPSControl | null {
    return this.getPSModel5(
      S._214,
      this.getAllPSDEDRControls(),
      objKey,
    ) as IPSControl;
  }

  get modelStamp(): string {
    return this.M.modelStamp;
  }

  protected psappmenumodel: IPSAppMenuModel;
  getPSAppMenuModel(): IPSAppMenuModel | null {
    return (
      this.psappmenumodel ||
      (this.psappmenumodel = this.fillObjectModel(
        S._219,
        this.M.getPSAppMenuModel,
        S._3da,
      ) as IPSAppMenuModel)
    );
  }
  get cls(): string {
    return 'PSSubAppRefImpl';
  }
  instanceof(cls: string): boolean {
    if (cls == S._3db) return true;
    return super.instanceof(cls);
  }
}
